package xyz.xmh.pattern.behavioral.strategypattern;

/**
 * @author Administrator
 * <p>
 * 环境类，情况类，根据不同的情况作出不同的行为
 */
public class Context {

    private Strategy strategy;

    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 执行策略
     *
     * @param num1 参数1
     * @param num2 参数2
     * @return 结果
     */
    public int executeStrategy(int num1, int num2) {
        return strategy.doOperation(num1, num2);
    }
}
